package so.shanku.essential.adapter;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import aym.util.json.JsonMap;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import so.shanku.essential.R;

import java.util.List;
import java.util.Map;

/**
 * 商城页 筛选功能
 */
public class SimpleBrandGridAdater extends MyBaseAdapter {

	public SimpleBrandGridAdater(Context context) {
		super(context);
	}

	public SimpleBrandGridAdater(Context context, List<? extends Map<String, ?>> datas) {
		super(context, datas);
	}

	@Override
	public int getCount() {
		return datas.size();
	}

	@Override
	public View getView(int i, View view, ViewGroup viewGroup) {

		ShoppingMallSelectHolder shoppingMallSelectHolder;
		if (view == null) {
			view = layoutInflater.inflate(R.layout.textview_shopmall_right, viewGroup, false);
			shoppingMallSelectHolder = new ShoppingMallSelectHolder(view);
			view.setTag(shoppingMallSelectHolder);
		} else {
			shoppingMallSelectHolder = (ShoppingMallSelectHolder) view.getTag();
		}
		JsonMap data = (JsonMap) datas.get(i);
		shoppingMallSelectHolder.tv_shopmall_right.setText(data.getStringNoNull("ShopName"));
		return view;
	}

	public class ShoppingMallSelectHolder {
		@ViewInject(R.id.tv_shopmall_right)
		public TextView tv_shopmall_right;

		public ShoppingMallSelectHolder(View view) {
			ViewUtils.inject(this, view);
		}
	}
}
